package com.cloud.poetry.system.controller;

import com.cloud.poetry.base.entity.User;
import com.cloud.poetry.system.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author mengxj
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("currentUser/{loginName}")
    public User currentUser(@PathVariable("loginName") String loginName){
        return this.userService.currentUser(loginName);
    }

    @GetMapping("list")
    public List<User> list(){
        return this.userService.list();
    }
}
